package com.ph.shopping.common.core.customenum;

/**
 * @项目：phshopping-facade-permission
 * @描述： 角色编号枚举
 * @作者： Mr.zheng
 * @创建时间：2017-03-14
 * @Copyright @2017 by Mr.zheng
 */
public enum RoleEnum {
    ADMIN(1,"管理员"),
    SUPPLIER(2,"供应商"),
    CITY_AGENT(3,"市级代理商"),
    COUNTY_AGENT(4,"县级代理商"),
    COMMUNITY_AGENT(5,"社区代理商"),
    MERCHANT(6,"商户");

    RoleEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private int code;
    private String message;

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static RoleEnum getRoleEnumByCode(int code) {
        RoleEnum[] roleEnums =  RoleEnum.values();
        for (RoleEnum roleEnum : roleEnums) {
            if (code == roleEnum.code) {
                return roleEnum;
            }
        }
        return null;
    }


}
